<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html">

    Click "Confirm Sales Order" to save sales order.
    Or choose "Cancel sales order" to go back to index.
    <br/>
    <h:form>
        <h:outputText style="font-weight: bold" value="Date and Time Ordered: " />
        <h:outputText value="#{salesOrderBean.dateOrdered}">
        </h:outputText>
        <br/>
        <h:outputText style="font-weight: bold" value="Based on Purchase Id: " />
        <h:outputText value="#{salesOrderBean.purchaseOrderId}">
        </h:outputText>
        <br/>
        <h:outputText style="font-weight: bold" value="Total Price: " />
        <h:outputText value="#{salesOrderBean.totalPrice}">
        </h:outputText>
        <br/><br/>
        <h:dataTable cellpadding="3px" cellspacing="5px" styleClass="allaroundborder" headerClass="allaroundborder" columnClasses="allaroundborder" 
                     rowClasses="allaroundborder" value="#{salesOrderBean.purchaseOrderItemList}" var="purchaseOrderItem">
            <h:column>
                <f:facet name="header">
                    <h:outputText value="Item Name" />
                </f:facet>
                <h:outputText value="#{purchaseOrderItem.productName}" />
            </h:column>    

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Quantity of Product" />
                </f:facet>
                <h:outputText value="#{purchaseOrderItem.numOfProduct}" />
            </h:column>    

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Product Price" />
                </f:facet>
                <h:outputText value="#{purchaseOrderItem.productPrice}" />
            </h:column>

            <h:column>
                <f:facet name="header">
                    <h:outputText value="Shipping Address" />
                </f:facet>
                <h:outputText value="#{purchaseOrderItem.shippingAddress}" />
            </h:column> 

        </h:dataTable>    

        <br/><br/>
        <h:commandButton action="confirmSalesOrderResult.xhtml" value="Proceed" actionListener="#{salesOrderBean.finaliseSalesOrder}"/>
        <br/><br/>
        <h:commandButton action="index.xhtml" value="Cancel Sales Order" actionListener="#{salesOrderBean.resetAll}"/>
         </h:form>
</ui:composition>